/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package comboboxview;

import data.Designation;
import data.Sections;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author Hùng
 */
public class DesignationCbview extends AbstractListModel implements ComboBoxModel{
    List<Designation> lDesign;
    Object selecttion ;

    public DesignationCbview() {
        this.lDesign = new ArrayList<Designation>();
        selecttion = null;
    }

    
    
    public DesignationCbview(List<Designation> lDesign) {
        this.lDesign = lDesign;
    }

    @Override
    public int getSize() {
        return lDesign.size();
    }

    @Override
    public Object getElementAt(int index) {
        return lDesign.get(index).getDesignation();
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selecttion = anItem;
    }

    @Override
    public Object getSelectedItem() {
        return selecttion;
    }
}
